//
//  BVIndexDetailsCell3.m
//  XiangYu
//
//  Created by YYKJ on 2017/8/4.
//  Copyright © 2017年 YYKJ. All rights reserved.
//

#import "BVIndexDetailsCell3.h"
#import "BVIndexDetailsCell4.h"

#define BUY_INDEX_COLLECTIONVIEW_CELL1 @"BVIndexCell1"
@implementation BVIndexDetailsCell3

-(void)makeSubViews{
    
    self.layout=[[UICollectionViewFlowLayout alloc]init];
    self.layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    [self.layout setItemSize:CGSizeMake (80, 100)];
    [self.layout setSectionInset:UIEdgeInsetsMake(2, 2, 2, 2)];
    [self.layout setMinimumLineSpacing:5];
    [self.layout setMinimumInteritemSpacing:5];
    
    self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, ScreenW, 100) collectionViewLayout:self.layout];
    [self.contentView addSubview:self.collectionView];
    [self.collectionView setBackgroundColor:[UIColor clearColor]];
    [self.collectionView setDelegate:self];
    [self.collectionView setDataSource:self];
    self.collectionView.scrollsToTop = NO;
    self.collectionView.showsVerticalScrollIndicator = NO;
    self.collectionView.showsHorizontalScrollIndicator = NO;
    [self.collectionView registerClass:[BVIndexDetailsCell4 class] forCellWithReuseIdentifier: BUY_INDEX_COLLECTIONVIEW_CELL1];
    
}

#pragma mark -- UICollectionViewDataSource ,UICollectionViewDelegate
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 6;
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    BVIndexDetailsCell4 * cell = (BVIndexDetailsCell4 *)[collectionView dequeueReusableCellWithReuseIdentifier:BUY_INDEX_COLLECTIONVIEW_CELL1 forIndexPath:indexPath];
    return cell;
}

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:( NSIndexPath *)indexPath{
   
    if (self.amplificationBlock) {
        self.amplificationBlock(indexPath.row);
    }
}

-(BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    return YES;
}

@end
